package com.aric.springbootmusic.entity.param;

import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RegisterUserParam {
    @NotBlank(message="用户名不能为空")
    private String username;
    @NotBlank(message="密码不能为空")
    @Size(min = 6,max = 13,message = "密码长度必须在6～13位")
    @Pattern(regexp="(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[~!@#$%^&+=])(?=\\S+$).{6,13}",message = "密码必须包含数字，大小写字母以及(_~!@#$%^&)括号中的任意一个字符")
    private String password;
    @NotBlank(message="昵称不能为空")
    private String nickname;
    //邮箱的验证规则
    @Email(message="邮箱不符合规则",regexp="^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
    private String email;
    //电话的验证规则
    @Pattern(regexp="^1\\d{10}$|^(0\\d{2,3}-?|\\(0\\d{2,3}\\))?[1-9]\\d{4,7}(-\\d{1,8})?$",message = "电话号码不符合规则")
    private String phoneNumber;
    @NotNull(message = "角色id不能为空")
    private Integer roleId;
}
